package com.stylefeng.guns.core.common.exception;

import com.stylefeng.guns.core.exception.ServiceExceptionEnum;

/**
 * @author fengshuonan
 * @Description 所有业务异常的枚举
 * @date 2016年11月12日 下午5:04:51
 */
public enum BizExceptionEnum implements ServiceExceptionEnum {

    /**
     * 字典
     */
    DICT_EXISTED(400, "字典已经存在"),
    ERROR_CREATE_DICT(500, "创建字典失败"),
    ERROR_WRAPPER_FIELD(500, "包装字典属性失败"),
    ERROR_CODE_EMPTY(500, "字典类型不能为空"),

    /**
     * 文件上传
     */
    FILE_READING_ERROR(400, "FILE_READING_ERROR!"),
    FILE_NOT_FOUND(400, "FILE_NOT_FOUND!"),
    UPLOAD_ERROR(500, "上传图片出错"),
    UPLOAD_WRITE_ERROR(500, "数据写入错误"),

    /**
     * 权限和数据问题
     */
    DB_RESOURCE_NULL(400, "数据库中没有该资源"),
    NO_PERMITION(405, "权限异常"),
    REQUEST_INVALIDATE(400, "请求数据格式不正确"),
    INVALID_KAPTCHA(400, "验证码不正确"),
    CANT_DELETE_ADMIN(600, "不能删除超级管理员"),
    CANT_FREEZE_ADMIN(600, "不能冻结超级管理员"),
    CANT_CHANGE_ADMIN(600, "不能修改超级管理员角色"),

    /**
     * 账户问题
     */
    USER_ALREADY_REG(401, "该用户已经注册"),
    NO_THIS_USER(400, "没有此用户"),
    USER_NOT_EXISTED(400, "没有此用户"),
    ACCOUNT_FREEZED(401, "账号被冻结"),
    OLD_PWD_NOT_RIGHT(402, "原密码不正确"),
    TWO_PWD_NOT_MATCH(405, "两次输入密码不一致"),

    /**
     * 错误的请求
     */
    MENU_PCODE_COINCIDENCE(400, "菜单编号和副编号不能一致"),
    EXISTED_THE_MENU(400, "菜单编号重复，不能添加"),
    DICT_MUST_BE_NUMBER(400, "字典的值必须为数字"),
    REQUEST_NULL(400, "请求有错误"),
    SESSION_TIMEOUT(400, "会话超时"),
    SERVER_ERROR(500, "服务器异常"),

    /**
     * token异常
     */
    TOKEN_EXPIRED(700, "token过期"),
    TOKEN_ERROR(700, "token验证失败"),

    /**
     * 签名异常
     */
    SIGN_ERROR(700, "签名验证失败"),

    /**
     * 其他
     */
    AUTH_REQUEST_ERROR(400, "账号密码错误"),

    APPLE_SFTP_UPLOAD_ERROR(10001,"文件上传出错了"),


    APPLE_EXCEL_FILE_TYPE_ERROR(20001,"文件格式不正确，请使用xls或者xlsx格式文件"),
    APPLE_EXCEL_SHEET_NOT_EXIST(20002,"文件Sheet数据为空"),
    APPLE_EXCEL_CELL_NOT_STRING(20003,"列表属性为字符类型"),
    APPLE_EXCEL_CELL_IS_NULL(20004,"内容不能为空"),
    APPLE_EXCEL_IMPORT_FAIL(20005,"Excel文件导入失败"),


    UPLOAD_MOBILE_PROFILE_ERROR(20006, "更新描述文件错误"),
    IPA_FILE_SIZE_OVER_LIMIT(20007, "ipa包过大"),
    IPA_UPDATE_FAILED(20008, "更新应用失败"),
    HANDLE_IPA_PUSHHOOK_ERROR(20009, "hook通知库失败"),
    CHANNEL_NAME_IS_NOLL(30001,"渠道名称不能为空"),
    SIGN_DEVICE_DATE_MT_30_DAYS(40001,"起止日期相隔不能大于30天"),

    DOMAIN_OPERATE_NOT_SUPPORT(40002, "不支持的域名操作"),
    DOMAIN_NOT_EXIST(40003, "域名不存在"),
    DOMAIN_IS_EXHAUST(40004, "无可用域名"),
    INFO_PLIST_READ_ERROR(40005, "plist文件读取失败"),
    APP_NAME_HAS_EXIST(40006, "同名应用已存在"),
    DOMAIN_NAME_HAS_EXIST(40007, "同名域名已存在"),
    APP_NOT_EXIST(40008, "应用不存在"),

    ID_DIS_ENABLE(50001,"购买数大于剩余可购买设备数"),

    PARAMS_ERROR(500500,"参数错误"),

    PUSH_MSG_PARAM_ERROR(51001,"消息参数错误"),
    PUSH_MSG_NOT_EXIST(51002,"消息不存在，请重新选择"),
    PUSH_MSG_FAIL(51003,"消息推送失败"),
    PUSH_MSG_TITLE_SIZE_TOO_LONG(51004,"标题字数不能超过30个字"),
    PUSH_MSG_CONTENT_SIZE_TOO_LONG(51005,"推送内容不能超过100个字"),

    DEVICE_TOKEN_INSERT_FAIL(52500,"device_token上报失败"),

    REGISTER_ERROR_PARAMS(60101,"注册信息错误")
    ;

    BizExceptionEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private Integer code;

    private String message;

    @Override
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
